package com.libnetwork

import com.libbase.utils.JsonUtils
import com.libbase.utils.genericType
import com.libnetwork.models.apiresult.APIResult
import org.junit.Assert.assertEquals
import org.junit.Test

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {
        assertEquals(4, 2 + 2)
    }

    @Test
    fun apiResult_isCorrect() {
        val apiResultStr = """
            {
                "code": 0,
                "data": {
                    "wd": "2",
                    "day": 3
                }
            }
        """.trimIndent()

        val result: APIResult<MutableMap<String, Any>> =
            JsonUtils.json.fromJson(apiResultStr, genericType<APIResult<String>>())

        assertEquals("test", result.data)
    }
}